

package com.yuye.excel.exception;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.NoHandlerFoundException;

import com.alibaba.excel.exception.ExcelAnalysisException;
import com.yuye.excel.base.dto.R;
import com.yuye.excel.utils.JsonUtil;



@RestControllerAdvice
public class ExcelExceptionHandler {
	private Logger logger = LoggerFactory.getLogger(getClass());

	

	
	@ExceptionHandler(ExcelAnalysisException.class)
	public String handleException(ExcelAnalysisException e){
		logger.error(e.getMessage(), e);
		
		return JsonUtil.toJson(R.error(501, e.getMessage()));
	}
	
}
